
function main( ui ) {

  return getAllUsers();

}

function getAllUsers() {

  var records = new JSONArray();
  
  
    //EntityManager.find( "SELECT t FROM UserEntity t WHERE userId = :1", toList([ "employee@mail.com1"]),  function(result) {
    //EntityManager.find( "SELECT t FROM UserEntity t WHERE userId = :u", toMap({u:"employee@mail.com"}),  function(result) {
  	EntityManager.find( "SELECT t FROM UserEntity t ", null,  function(result) {
      
      for( var i = 0; i < result.size() ; ++i ) {
        
        records.put( JSONObject.wrap(result.get(i)) );
      }
      
    });
    
    var result = new JSONObject();
    
    result.put( "records", records );
    

    return result.toString() ;

}

